/**
 * Project pro_con
 * @author lwj
 */


#ifndef _PRODUCTQUEUE_H
#define _PRODUCTQUEUE_H

#include "Producer.h"
#include <queue>
#include <mutex>
#include <condition_variable>

using std::queue;
using std::mutex;
using std::condition_variable;


class ProductQueue{
public: 
    
int pop();
    
/**
 * @param num
 */
void push(int & num);
    
bool empty();
    
bool full();

size_t getSize();

ProductQueue(std::size_t size);
    
~ProductQueue();
private: 
    queue<int> _que;
    std::size_t _capacity;
    mutex _mux;
    condition_variable _nopro;
    condition_variable _fullpro;

};

#endif //_PRODUCTQUEUE_H
